<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGoodsAttributeAccessIdTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create ('goods_attribute_access_id', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->uuid ('goods_id');//商品ID
            $table->uuid ('attribute_access_id');//属性关联ID
            $table->foreign ('goods_id')->references ('id')->on ('goods')->onDelete ('cascade');//商品外键
            $table->foreign ('attribute_access_id')->references ('id')->on ('goods_attribute_access')->onDelete ('cascade');//属性关联外键
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists ('goods_attribute_access_id');
    }
}
